<?php

  class KefuAction extends CommonAction{
  
    public function index(){

	
	  if(!empty($_POST)){
	  
	     $re=M('kefu')->add($_POST);
		 
		 if($re){
		
		  $this->success('添加成功');exit();
		
		}else{
		
		  $this->error('添加失败');
		
		}
		 
	  
	  }
	
	
	  $this->re=M('kefu')->select();
	
	  $this->display();
	
	}
	
	public function add(){
	
	  if(!empty($_POST)){
	  
	    $re=M('kefu')->add($_POST);
	    
		if($re){
		
		  $ajax=1;
		
		}else{
		
		  $ajax=2;
		
		}
	  
	    $this->ajaxReturn($ajax);
	  
	  }
	
	}
	
	
	public function del(){
	
	  $this->ajaxReturn((M('kefu')->where('id="%s"',$_POST['id'])->delete())?1:2);
	
	
	}
  
  
  }